import requests,json

# 地理编码
def geocode(key,address,city=None,batch="false",sig=None,output="json",callback=None):
    """地理编码"""
    url = "https://restapi.amap.com/v3/geocode/geo?parameters"
    params = {
    "key":key,
    "address":address,
    "city":city,
    "batch":batch,
    "sig":sig,
    "output":output,
    "callback":callback
    }
    r = requests.get(url,params)
    results = r.json()
    return results

# 骑行
def bicycling(key,origin,destination):
    """骑行"""
    bicycling_url = "https://restapi.amap.com/v4/direction/bicycling?parameters"
    params = {
        "key":key,
        "origin":origin,
        "destination":destination
    }
    r = requests.get(bicycling_url,params)
    results=r.json()
    return results